home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: What's so different about 2-D arrays???
- Date: Mon, 01 Jan 96 21:12:27 GMT
- Organization: none
- Message-ID: <820530747snz@genesis.demon.co.uk>
- References: <4c799b$q9d@umbc9.umbc.edu> <4c8kdh$4qg@news1.usa.pipeline.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4c8kdh$4qg@news1.usa.pipeline.com>
- grantp@usa.pipeline.com(Pete) "Pete" writes:
-
- >>Please read the FAQ. This will show you why 'int main (void)' is the
- >correct
- >>declaration for your particular program.
- >
- >As long as we're being so nit-picky, where in the FAQ does it say
- >exactly that? All I can find is "int main ()".
-
- 11.12: Can I declare main() as void, to shut off these annoying "main
- returns no value" messages?
-
- A: No. main() must be declared as returning an int, and as taking
- either zero or two arguments, of the appropriate types. If
- you're calling exit() but still getting warnings, you may have
- to insert a redundant return statement (or use some kind of "not
- reached" directive, if available).
-
- Declaring a function as void does not merely shut off or
- rearrange warnings: it may also result in a different function
- call/return sequence, incompatible with what the caller (in
- main's case, the C run-time startup code) expects.
-
- The difference between int main() and int main(void) is rather acedemic and
- isn't an issue here. They mean the same thing but the ANSI standard
- classes the former as an "obsolescent feature" which suggests that support
- for it may be dropped in future revisions of the language.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-